package cn.rongdao.jrkabao.ui.loan.adapter.viewholder;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerAdapter;
import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerViewHolder;

import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.loan.MultiPushBean;
import cn.rongdao.jrkabao.ui.loan.adapter.MultiPushItemAdapter;
import cn.rongdao.jrkabao.ui.loan.adapter.listener.MutliPustitemClickListener;
import cn.rongdao.jrkabao.ui.loan.uicomponent.CommonHeaderUIComponent;

/**
 * Created by jack on 17/5/16
 */

public class MultiPushViewHolder extends FRBaseRecyclerViewHolder<MultiPushBean> implements FRBaseRecyclerAdapter.OnItemClickListener<FRBaseRecyclerViewHolder<MultiPushBean.ProductListBean>> {

    private final CommonHeaderUIComponent mHeaderView;
    private final RecyclerView mRecyclerview;
    private final MultiPushItemAdapter mMultiPushItemAdapter;

    public MultiPushViewHolder(View itemView, MutliPustitemClickListener listener) {
        super(itemView);
        mHeaderView = findView(R.id.impna_header);
        mRecyclerview = findView(R.id.impna_recycelerview);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
        mRecyclerview.setLayoutManager(layoutManager);

        mMultiPushItemAdapter = new MultiPushItemAdapter(getContext(),listener);
        mRecyclerview.setAdapter(mMultiPushItemAdapter);
    }


    @Override
    protected void onItemDataUpdated(MultiPushBean productList) {
        mHeaderView.setContent(productList.getType_desc());
        mMultiPushItemAdapter.setDataList(productList.getProduct_list());
    }

    @Override
    public void onItemClick(FRBaseRecyclerViewHolder<MultiPushBean.ProductListBean> productListBeanFRBaseRecyclerViewHolder, int position) {

    }
}